import React from 'react'
import getMovieRequest from "../../api/getMovieRequest"
import {getMovieAction} from "../../store/actions/movieAction"
import store from '../../store/store'
export default function Movie() {


  const getMovieHandle= async()=>{
    const re =await getMovieRequest()
  store.dispatch(getMovieAction(re.data))  
  }

  const {movie} = store.getState().movie
  
  return (
    <div>
      <button onClick={getMovieHandle}>点击查询电影</button>
        <h1>电影的数量是{movie.length}</h1>
        <ul>
          {movie.map(item=>{
            return <li key={item.albumId}>{item.name}</li>
          })}
        </ul>
    </div>
  )
}
